home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / asm / TBSource.lha / ShellTerm / STv1.05.S < prev    next >
Text File  |  1993-07-02  |  44KB  |  2,183 lines

  1. *************************************************
  2. *                        *
  3. *         (C)opyright 1992        *
  4. *                        *
  5. *        by  Tomi Blinnikka        *
  6. *                        *
  7. *    Don´t try to understand the code    *
  8. *                        *
  9. * Version 0.01    28/05/1992            *
  10. *     -0.99ö                    *
  11. *                        *
  12. * Version 1.00    04/08/1992            *
  13. *                        *
  14. * BUGS: Lots! No phonebook.            *
  15. *                        *
  16. * Version 1.01    05/08/1992            *
  17. *                        *
  18. * BUGS: Some. Dialer problems.            *
  19. *                        *
  20. * Version 1.02    06/08/1992            *
  21. *                        *
  22. * BUGS: Less. Still dialer problems.        *
  23. *                        *
  24. * Version 1.03    08/08/1992            *
  25. *                        *
  26. * BUGS:                     *
  27. *                        *
  28. * Version 1.04    11/08/1992            *
  29. *                        *
  30. * Released                    *
  31. *                        *
  32. * BUGS: Send CTRL-P didn't work            *
  33. *                        *
  34. * Version 1.05    15/08/1992            *
  35. *                        *
  36. *************************************************
  37.  
  38.     INCLUDE    "JMPLibs.i"
  39.     INCLUDE    "exec/types.i"
  40.     INCLUDE    "exec/nodes.i"
  41.     INCLUDE    "exec/lists.i"
  42.     INCLUDE    "exec/ports.i"
  43.     INCLUDE    "exec/memory.i"
  44.     INCLUDE    "exec/devices.i"
  45.     INCLUDE    "exec/io.i"
  46.     INCLUDE    "exec/tasks.i"
  47.     INCLUDE    "libraries/dosextens.i"
  48.     INCLUDE    "libraries/dos.i"
  49.     INCLUDE    "devices/serial.i"
  50.  
  51.     INCLUDE    "XREF:2.0.xref"
  52.     INCLUDE    "XREF:exec.xref"
  53.     INCLUDE    "XREF:dos.xref"
  54.  
  55.  
  56. LF:        EQU    10
  57. CR:        EQU    13
  58. CTRL_O:        EQU    $0F
  59. CTRL_P:        EQU    $10
  60.  
  61. QUIT_KEY:    EQU    CTRL_P
  62. STATS_KEY:    EQU    CTRL_O
  63.  
  64. FALSE:        EQU    0
  65. TRUE:        EQU    1
  66.  
  67. BUFLEN:        EQU    1024
  68.  
  69.         section    ST,CODE
  70.  
  71.         push    d2-d7/a2-a6
  72.         push    d0/a0
  73.  
  74.         sub.l    a1,a1            ;Find our task
  75.         lib    Exec,FindTask
  76.         move.l    d0,OurTask
  77.  
  78.         openlib    Dos,NoDos        ;Keep at beginning
  79.  
  80. CLIStart:    lib    Dos,Output
  81.         move.l    d0,_stdout
  82.         lib    Dos,Input
  83.         move.l    d0,_stdin
  84.         move.l    d0,d1
  85.         lib    Dos,IsInteractive
  86.         tst.l    d0
  87.         beq    NotInteractive
  88.         pull    d0/a0
  89.         clr.b    -1(a0,d0.l)
  90.         cmp.b    #'?',(a0)
  91.         beq    Usage
  92.         cmp.w    #'-?',(a0)
  93.         beq    Usage
  94.         cmp.w    #'-h',(a0)
  95.         beq    Usage
  96.  
  97. Cont0.2:    bsr    ConvASCII
  98.         tst.w    d0
  99.         beq    Cont1
  100.         move.w    d0,SerUnit
  101. Cont1:        cmp.b    #' ',(a0)
  102.         bne    Cont1.1
  103.         add.l    #1,a0
  104. Cont1.1:    tst.b    (a0)
  105.         beq    Cont1.2
  106.         move.l    a0,SerName
  107. Cont1.2:
  108.  
  109. ;Create read reply port for serial.device (or modem0.device etc.)
  110.  
  111. MainStart:    lib    Exec,CreateMsgPort
  112.         move.l    d0,SRRPort
  113.         beq    NoMsgPort
  114.  
  115. ;Create read IOReq for serial.device (or for other device, but size is EXTSER)
  116.  
  117.         move.l    #IOEXTSER_SIZE,d0
  118.         move.l    SRRPort,a0
  119.         lib    Exec,CreateIORequest
  120.         move.l    d0,IORRequest
  121.         beq    NoIOReq
  122.  
  123.         move.l    IORRequest,a1
  124.         move.w    #CMD_READ,IO_COMMAND(a1)
  125.         or.b    #IOF_QUICK,IO_FLAGS(a1)
  126.         lea.l    Buffer3,a0
  127.         move.l    a0,IO_DATA(a1)
  128.         move.l    #1,IO_LENGTH(a1)
  129.  
  130. ;Create write reply port for serial.device (or modem0.device etc.)
  131.  
  132.         lib    Exec,CreateMsgPort
  133.         move.l    d0,SWRPort
  134.         beq    NoMsgPort
  135.  
  136. ;Create write IOReq for serial.device (or for other device, but size is EXTSER)
  137.  
  138.         move.l    #IOEXTSER_SIZE,d0
  139.         move.l    SWRPort,a0
  140.         lib    Exec,CreateIORequest
  141.         move.l    d0,IOWRequest
  142.         beq    NoIOReq
  143.  
  144.         bsr    WriteDefaults
  145.  
  146. ;open serial.device
  147.  
  148.         move.l    SerName,a0
  149.         move.l    SerUnit,d0
  150.         move.l    IORRequest,a1
  151.         move.b    #SERF_SHARED,IO_SERFLAGS(a1)
  152.         move.b    DataBits,IO_READLEN(a1)
  153.         move.b    DataBits,IO_WRITELEN(a1)
  154.         move.b    StopBits,IO_STOPBITS(a1)
  155.         clr.l    d1                ;no flags
  156.         lib    Exec,OpenDevice
  157.         tst.l    d0
  158.         bne    NoSerial
  159.         move.w    #$1,SerOpen        ;just to tell if open
  160.  
  161. ;Copy info from one req to the other
  162.  
  163.         move.l    IORRequest,a0
  164.         move.l    IOWRequest,a1
  165.         move.l    IO_DEVICE(a0),IO_DEVICE(a1)
  166.         move.l    IO_UNIT(a0),IO_UNIT(a1)
  167.         add.l    #48,a0            ;get start of ioser
  168.         add.l    #48,a1
  169.         move.l    #34,d0
  170.         lib    Exec,CopyMem
  171.         lea.l    StartText1,a0
  172.         bsr    Printer
  173.  
  174.         bsr    DoPhoneBook
  175.  
  176. ;Change mode for CLI to RAW:
  177.  
  178.         move.l    _stdin,d1
  179.         move.l    #TRUE,d2
  180.         lib    Dos,SetMode
  181.  
  182. ;Flush extra text
  183.  
  184.         move.l    _stdin,d1
  185.         lib    Dos,Flush
  186.  
  187. Looper:        move.l    _stdin,d1
  188.         move.l    #5000,d2
  189.         lib    Dos,WaitForChar
  190.         tst.l    d0
  191.         beq    Looper1
  192.         move.l    _stdin,d1
  193.         lea.l    Buffer1,a0
  194.         move.l    a0,d2
  195.         move.l    #1,d3
  196.         lib    Dos,Read
  197.         cmp.b    #QUIT_KEY,Buffer1
  198.         beq    Menu
  199.         bsr    DoCLIInput
  200. Looper1:    move.l    #BUFLEN,d0
  201.         move.l    #1,d1
  202.         bsr    Read
  203.         tst.l    d0
  204.         beq    Looper
  205.  
  206.         lea.l    Buffer3,a0
  207.         clr.b    0(a0,d0.l)    ;null terminated, please!
  208.  
  209.         bsr    DoSerialInput
  210.  
  211.         move.l    _stdout,d1
  212.         lea.l    Buffer4,a1
  213.         bsr    GetLength
  214.         move.l    d0,d3
  215.         lea.l    Buffer4,a0
  216.         move.l    a0,d2
  217.         lib    Dos,Write
  218.  
  219.         bra    Looper
  220.  
  221. Menu:        lea.l    MenuText1,a0
  222.         bsr    Printer
  223. Menu1:        move.l    _stdin,d1
  224.         lib    Dos,FGetC
  225.         cmp.l    #-1,d0
  226.         beq    ShutDown
  227.         cmp.l    #'p',d0
  228.         beq    Prefs
  229.         cmp.l    #'P',d0
  230.         beq    Prefs
  231.         cmp.l    #'s',d0
  232.         beq    DoStats
  233.         cmp.l    #'S',d0
  234.         beq    DoStats
  235.         cmp.l    #'c',d0
  236.         beq    ClearBoth
  237.         cmp.l    #'C',d0
  238.         beq    ClearBoth
  239.         cmp.l    #'d',d0
  240.         beq    Dialer
  241.         cmp.l    #'D',d0
  242.         beq    Dialer
  243.         cmp.l    #'o',d0
  244.         beq    DoCTRL_P
  245.         cmp.l    #'O',d0
  246.         beq    DoCTRL_P
  247.         cmp.l    #'f',d0
  248.         beq    ResetFont
  249.         cmp.l    #'F',d0
  250.         beq    ResetFont
  251.         cmp.l    #'x',d0
  252.         beq    ClearScreen
  253.         cmp.l    #'X',d0
  254.         beq    ClearScreen
  255.         cmp.l    #'r',d0
  256.         beq    DoReset
  257.         cmp.l    #'R',d0
  258.         beq    DoReset
  259.         cmp.l    #'h',d0
  260.         beq    DoHangUp
  261.         cmp.l    #'H',d0
  262.         beq    DoHangUp
  263.         cmp.l    #'?',d0
  264.         beq    DoInfo
  265.         cmp.l    #'q',d0
  266.         beq    Quit
  267.         cmp.l    #'Q',d0
  268.         beq    Quit
  269.         cmp.l    #'e',d0
  270.         beq    Exit1
  271.         cmp.l    #'E',d0
  272.         beq    Exit1
  273.         bra    Menu1
  274. Exit1:        lea.l    ExitText1,a0
  275.         bsr    Printer
  276.         bra    Looper1
  277.  
  278. ResetFont:    lea.l    ResetFText1,a0
  279.         bsr    Printer
  280.         lea.l    PlainText1,a0
  281.         bsr    Printer
  282.         bra    Menu
  283.  
  284. ClearScreen:    lea.l    ClearSText1,a0
  285.         bsr    Printer
  286.         bra    Exit
  287.  
  288. DoStats:    lea.l    StatsText2,a0
  289.         bsr    Printer
  290.         lea.l    CRLFText1,a0
  291.         bsr    Printer
  292.         bsr    GiveStats
  293.         bsr    GetAnyKey
  294.         bra    Menu
  295.  
  296. ClearBoth:    lea.l    ClearText1,a0
  297.         bsr    Printer
  298.         clr.l    Received
  299.         clr.l    Sent
  300.         bra    Menu
  301.  
  302. DoCTRL_P:    move.b    #CTRL_P,Buffer1
  303.         bsr    Writer
  304.         lea.l    CTRL_PText1,a0
  305.         bsr    Printer
  306.         add.l    #1,Sent
  307.         bra    Exit
  308.  
  309. DoReset:    lea.l    ResetText1,a0
  310.         bsr    Printer
  311.         lea.l    ResetText2,a1
  312.         bsr    GetLength
  313.         lea.l    ResetText2,a0
  314.         bsr    Writer2
  315.         bra    Exit
  316.  
  317. DoHangUp:    lea.l    HangUpText1,a0
  318.         bsr    Printer
  319.         move.l    #3*50,d1
  320.         lib    Dos,Delay
  321.         lea.l    HangUpText2,a1
  322.         bsr    GetLength
  323.         lea.l    HangUpText2,a0
  324.         bsr    Writer2
  325.         move.l    #2*55,d1
  326.         lib    Dos,Delay
  327.         lea.l    HangUpText3,a1
  328.         bsr    GetLength
  329.         lea.l    HangUpText3,a0
  330.         bsr    Writer2
  331.         bra    Exit
  332.  
  333. DoInfo:        lea.l    InfoText1,a0
  334.         bsr    Printer
  335.         lea.l    AuthorText1,a0
  336.         bsr    Printer
  337.         bsr    GetAnyKey
  338.         bra    Menu
  339.  
  340. Quit:        lea.l    QuitText1,a0
  341.         bsr    Printer
  342.         lea.l    CRLFText1,a0
  343.         bsr    Printer
  344.         bsr    GiveStats
  345.         bra    ShutDown
  346.  
  347. Exit:        lea.l    TerminalText1,a0
  348.         bsr    Printer
  349.         bra    Looper1
  350.  
  351. Dialer:        lea.l    DialerText1,a0
  352.         bsr    Printer
  353. Dialer0.1:    lea.l    DialerText2,a0
  354.         bsr    Printer
  355. Dialer0.2:    bsr    PrintEntries
  356. Dialer0.3:    bsr    PrintSelect
  357. Dialer0.4:    lea.l    DialerText3,a0
  358.         bsr    Printer
  359. Dialer1:    move.l    _stdin,d1
  360.         lib    Dos,FGetC
  361.         cmp.l    #-1,d0
  362.         beq    Menu
  363.         cmp.l    #'0',d0
  364.         beq    DoEntry0
  365.         cmp.l    #'1',d0
  366.         beq    DoEntry1
  367.         cmp.l    #'2',d0
  368.         beq    DoEntry2
  369.         cmp.l    #'3',d0
  370.         beq    DoEntry3
  371.         cmp.l    #'4',d0
  372.         beq    DoEntry4
  373.         cmp.l    #'5',d0
  374.         beq    DoEntry5
  375.         cmp.l    #'6',d0
  376.         beq    DoEntry6
  377.         cmp.l    #'7',d0
  378.         beq    DoEntry7
  379.         cmp.l    #'8',d0
  380.         beq    DoEntry8
  381.         cmp.l    #'9',d0
  382.         beq    DoEntry9
  383.         cmp.l    #'D',d0
  384.         beq    DialList
  385.         cmp.l    #'d',d0
  386.         beq    DialList
  387.         cmp.l    #'E',d0
  388.         beq    Exit1
  389.         cmp.l    #'e',d0
  390.         beq    Exit1
  391.         cmp.l    #'M',d0
  392.         beq    MainMenu
  393.         cmp.l    #'m',d0
  394.         beq    MainMenu
  395.         cmp.l    #'-',d0
  396.         beq    MainMenu
  397.         cmp.l    #'S',d0
  398.         beq    SingleDial
  399.         cmp.l    #'s',d0
  400.         beq    SingleDial
  401.         cmp.l    #'R',d0
  402.         beq    Relist
  403.         cmp.l    #'r',d0
  404.         beq    Relist
  405.         cmp.l    #'C',d0
  406.         beq    ClearList
  407.         cmp.l    #'c',d0
  408.         beq    ClearList
  409.         cmp.l    #'A',d0
  410.         beq    SelectAll
  411.         cmp.l    #'a',d0
  412.         beq    SelectAll
  413.         cmp.l    #'h',d0
  414.         beq    DialerHelp
  415.         cmp.l    #'H',d0
  416.         beq    DialerHelp
  417.         cmp.l    #'?',d0
  418.         beq    DialerHelp
  419.         bra    Dialer1
  420.  
  421. DialerHelp:    lea.l    HelpText1,a0
  422.         bsr    Printer
  423.         bra    Dialer0.4
  424.  
  425. ClearList:    lea.l    ClearText2,a0
  426.         bsr    Printer
  427.         clr.l    EntrySelected1
  428.         clr.l    EntrySelected5
  429.         clr.w    EntrySelected9
  430.         bra    DoEntry_OUT1
  431.  
  432. SelectAll:    lea.l    AllText1,a0
  433.         bsr    Printer
  434.         move.l    #$01010101,EntrySelected1
  435.         move.l    #$01010101,EntrySelected5
  436.         move.w    #$0101,EntrySelected9
  437.         bra    DoEntry_OUT1
  438.  
  439. DoEntry1:    bchg.b    #0,EntrySelected1
  440.         bra    DoEntry_OUT
  441. DoEntry2:    bchg.b    #0,EntrySelected2
  442.         bra    DoEntry_OUT
  443. DoEntry3:    bchg.b    #0,EntrySelected3
  444.         bra    DoEntry_OUT
  445. DoEntry4:    bchg.b    #0,EntrySelected4
  446.         bra    DoEntry_OUT
  447. DoEntry5:    bchg.b    #0,EntrySelected5
  448.         bra    DoEntry_OUT
  449. DoEntry6:    bchg.b    #0,EntrySelected6
  450.         bra    DoEntry_OUT
  451. DoEntry7:    bchg.b    #0,EntrySelected7
  452.         bra    DoEntry_OUT
  453. DoEntry8:    bchg.b    #0,EntrySelected8
  454.         bra    DoEntry_OUT
  455. DoEntry9:    bchg.b    #0,EntrySelected9
  456.         bra    DoEntry_OUT
  457. DoEntry0:    bchg.b    #0,EntrySelected0
  458. DoEntry_OUT:    lea.l    EntryTextXIV,a0
  459.         bsr    Printer
  460. DoEntry_OUT1:    bsr    PrintSelect
  461.         lea.l    SelectionText1,a0
  462.         bsr    Printer
  463.         bra    Dialer1
  464.  
  465. MainMenu:    lea.l    MainMenuText1,a0
  466.         bsr    Printer
  467.         bra    Menu
  468.  
  469. DialList:    lea.l    DialText1,a0
  470.         bsr    Printer
  471.         lea.l    DialText2,a0
  472.         bsr    Printer
  473.  
  474. DialList1:    lea.l    EntrySelected1,a2
  475.         tst.b    (a2)
  476.         beq    DialList2
  477.         lea.l    Entry1,a0
  478.         tst.b    (a0)
  479.         beq    DialList1.1
  480.         bsr    DialEntry
  481.         tst.l    d0
  482.         beq    Exit
  483.         cmp.l    #2,d0        ;cancel
  484.         beq    Dialer0.1
  485.         cmp.l    #3,d0        ;remove
  486.         bne    DialList2
  487. DialList1.1:    clr.b    (a2)
  488. DialList2:    lea.l    EntrySelected2,a2
  489.         tst.b    (a2)
  490.         beq    DialList3
  491.         lea.l    Entry2,a0
  492.         tst.b    (a0)
  493.         beq    DialList2.1
  494.         bsr    DialEntry
  495.         tst.l    d0
  496.         beq    Exit
  497.         cmp.l    #2,d0        ;cancel
  498.         beq    Dialer0.1
  499.         cmp.l    #3,d0        ;remove
  500.         bne    DialList3
  501. DialList2.1:    clr.b    (a2)
  502. DialList3:    lea.l    EntrySelected3,a2
  503.         tst.b    (a2)
  504.         beq    DialList4
  505.         lea.l    Entry3,a0
  506.         tst.b    (a0)
  507.         beq    DialList3.1
  508.         bsr    DialEntry
  509.         tst.l    d0
  510.         beq    Exit
  511.         cmp.l    #2,d0        ;cancel
  512.         beq    Dialer0.1
  513.         cmp.l    #3,d0        ;remove
  514.         bne    DialList4
  515. DialList3.1:    clr.b    (a2)
  516. DialList4:    lea.l    EntrySelected4,a2
  517.         tst.b    (a2)
  518.         beq    DialList5
  519.         lea.l    Entry4,a0
  520.         tst.b    (a0)
  521.         beq    DialList4.1
  522.         bsr    DialEntry
  523.         tst.l    d0
  524.         beq    Exit
  525.         cmp.l    #2,d0        ;cancel
  526.         beq    Dialer0.1
  527.         cmp.l    #3,d0        ;remove
  528.         bne    DialList5
  529. DialList4.1:    clr.b    (a2)
  530. DialList5:    lea.l    EntrySelected5,a2
  531.         tst.b    (a2)
  532.         beq    DialList6
  533.         lea.l    Entry5,a0
  534.         tst.b    (a0)
  535.         beq    DialList5.1
  536.         bsr    DialEntry
  537.         tst.l    d0
  538.         beq    Exit
  539.         cmp.l    #2,d0        ;cancel
  540.         beq    Dialer0.1
  541.         cmp.l    #3,d0        ;remove
  542.         bne    DialList6
  543. DialList5.1:    clr.b    (a2)
  544. DialList6:    lea.l    EntrySelected6,a2
  545.         tst.b    (a2)
  546.         beq    DialList7
  547.         lea.l    Entry6,a0
  548.         tst.b    (a0)
  549.         beq    DialList6.1
  550.         bsr    DialEntry
  551.         tst.l    d0
  552.         beq    Exit
  553.         cmp.l    #2,d0        ;cancel
  554.         beq    Dialer0.1
  555.         cmp.l    #3,d0        ;remove
  556.         bne    DialList7
  557. DialList6.1:    clr.b    (a2)
  558. DialList7:    lea.l    EntrySelected7,a2
  559.         tst.b    (a2)
  560.         beq    DialList8
  561.         lea.l    Entry7,a0
  562.         tst.b    (a0)
  563.         beq    DialList7.1
  564.         bsr    DialEntry
  565.         tst.l    d0
  566.         beq    Exit
  567.         cmp.l    #2,d0        ;cancel
  568.         beq    Dialer0.1
  569.         cmp.l    #3,d0        ;remove
  570.         bne    DialList8
  571. DialList7.1:    clr.b    (a2)
  572. DialList8:    lea.l    EntrySelected8,a2
  573.         tst.b    (a2)
  574.         beq    DialList9
  575.         lea.l    Entry8,a0
  576.         tst.b    (a0)
  577.         beq    DialList8.1
  578.         bsr    DialEntry
  579.         tst.l    d0
  580.         beq    Exit
  581.         cmp.l    #2,d0        ;cancel
  582.         beq    Dialer0.1
  583.         cmp.l    #3,d0        ;remove
  584.         bne    DialList9
  585. DialList8.1:    clr.b    (a2)
  586. DialList9:    lea.l    EntrySelected9,a2
  587.         tst.b    (a2)
  588.         beq    DialList10
  589.         lea.l    Entry9,a0
  590.         tst.b    (a0)
  591.         beq    DialList9.1
  592.         bsr    DialEntry
  593.         tst.l    d0
  594.         beq    Exit
  595.         cmp.l    #2,d0        ;cancel
  596.         beq    Dialer0.1
  597.         cmp.l    #3,d0        ;remove
  598.         bne    DialList10
  599. DialList9.1:    clr.b    (a2)
  600. DialList10:    lea.l    EntrySelected0,a2
  601.         tst.b    (a2)
  602.         beq    DialList11
  603.         lea.l    Entry10,a0
  604.         tst.b    (a0)
  605.         beq    DialList10.1
  606.         bsr    DialEntry
  607.         tst.l    d0
  608.         beq    Exit
  609.         cmp.l    #2,d0        ;cancel
  610.         beq    Dialer0.1
  611.         cmp.l    #3,d0        ;remove
  612.         bne    DialList11
  613. DialList10.1:    clr.b    (a2)
  614. DialList11:    tst.l    EntrySelected1
  615.         bne    DialList1
  616.         tst.l    EntrySelected5
  617.         bne    DialList1
  618.         tst.w    EntrySelected9
  619.         bne    DialList1
  620.         lea.l    EmptyText1,a0
  621.         bsr    Printer
  622.         bra    Dialer0.1
  623.  
  624. Relist:        lea.l    RelistText1,a0
  625.         bsr    Printer
  626.         bra    Dialer0.2
  627.  
  628. SingleDial:    lea.l    SingleText1,a0
  629.         bsr    Printer
  630.  
  631.         lea.l    SingleText2,a0
  632.         bsr    Printer
  633.  
  634.         move.l    _stdin,d1
  635.         move.l    #FALSE,d2
  636.         lib    Dos,SetMode
  637.  
  638.         move.l    _stdin,d1
  639.         lea.l    DialBuffer1,a0
  640.         move.l    a0,d2
  641.         move.l    #16,d3
  642.         lib    Dos,FGets
  643.         tst.l    d0
  644.         beq    Dialer0.1
  645.  
  646.         lea.l    DialBuffer1,a0
  647.         bsr    GetLLength
  648.         clr.b    -1(a0,d1.l)    ;remove LF
  649.  
  650.         move.l    _stdin,d1
  651.         move.l    #TRUE,d2
  652.         lib    Dos,SetMode
  653.  
  654.         lea.l    DialBuffer1,a1
  655.         bsr    GetLength
  656.         tst.l    d0
  657.         beq    Dialer0.1
  658.  
  659.         lea.l    DialText2,a0
  660.         bsr    Printer
  661.  
  662. SingleDial1:    lea.l    DialBuffer1,a0
  663.         bsr    DialEntry
  664.         tst.l    d0
  665.         beq    Exit
  666.         cmp.l    #1,d0
  667.         beq    SingleDial1
  668.         cmp.l    #2,d0
  669.         beq    Dialer0.1
  670.         cmp.l    #3,d0
  671.         beq    Dialer0.1
  672.         bra    Dialer0.1
  673.  
  674. Prefs:        lea.l    PrefsText1,a0
  675.         bsr    Printer
  676. Prefs1:        lea.l    PrefsText2,a0
  677.         bsr    Printer
  678. Prefs2:        move.l    _stdin,d1
  679.         lib    Dos,FGetC
  680.         cmp.l    #-1,d0
  681.         beq    Menu
  682.         cmp.l    #'S',d0
  683.         beq    SetSpeed
  684.         cmp.l    #'s',d0
  685.         beq    SetSpeed
  686.         cmp.l    #'L',d0
  687.         beq    SetLocalEcho
  688.         cmp.l    #'l',d0
  689.         beq    SetLocalEcho
  690.         cmp.l    #'R',d0
  691.         beq    ClearSettings
  692.         cmp.l    #'r',d0
  693.         beq    ClearSettings
  694.         cmp.l    #'E',d0
  695.         beq    Exit1
  696.         cmp.l    #'e',d0
  697.         beq    Exit1
  698.         cmp.l    #'V',d0
  699.         beq    DoView
  700.         cmp.l    #'v',d0
  701.         beq    DoView
  702.         cmp.l    #'M',d0
  703.         beq    MainMenu
  704.         cmp.l    #'m',d0
  705.         beq    MainMenu
  706.         cmp.l    #'-',d0
  707.         beq    MainMenu
  708.         cmp.l    #'1',d0
  709.         beq    SetCRTrans
  710.         cmp.l    #'2',d0
  711.         beq    SetLFTrans
  712.         cmp.l    #'3',d0
  713.         beq    SetCRTransIn
  714.         cmp.l    #'4',d0
  715.         beq    SetLFTransIn
  716.         cmp.l    #'5',d0
  717.         beq    SetDataBits
  718.         cmp.l    #'6',d0
  719.         beq    SetStopBits
  720.         bra    Prefs2
  721.  
  722. DoView:        lea.l    ViewText1,a0
  723.         bsr    Printer
  724.         bsr    GiveSettings
  725.         bsr    GetAnyKey
  726.         bra    Prefs1
  727.  
  728. ClearSettings:    lea.l    ClearText3,a0
  729.         bsr    Printer
  730.         move.l    #9600,Speed
  731.         move.b    #8,DataBits
  732.         move.b    #1,StopBits
  733.         clr.l    CRTranslate
  734.         bsr    SetSerParams
  735.         tst.l    d0
  736.         beq    Prefs1
  737.         lea.l    SerSetText1,a0
  738.         bsr    Printer
  739.         bra    Prefs1
  740.  
  741. SetCRTrans:    lea.l    CRTransText1,a0
  742.         bsr    Printer
  743.         lea.l    CRTransText2,a0
  744.         bsr    Printer
  745.         bsr    GetNSA
  746.         cmp.l    #-1,d0
  747.         beq    Prefs1
  748.         move.b    d0,CRTranslate
  749.         bra    Prefs1
  750.  
  751. SetLFTrans:    lea.l    LFTransText1,a0
  752.         bsr    Printer
  753.         lea.l    LFTransText2,a0
  754.         bsr    Printer
  755.         bsr    GetNSA
  756.         cmp.l    #-1,d0
  757.         beq    Prefs1
  758.         move.b    d0,LFTranslate
  759.         bra    Prefs1
  760.  
  761. SetCRTransIn:    lea.l    CRTransText3,a0
  762.         bsr    Printer
  763.         lea.l    CRTransText2,a0
  764.         bsr    Printer
  765.         bsr    GetNSA
  766.         cmp.l    #-1,d0
  767.         beq    Prefs1
  768.         move.b    d0,CRTranslateIn
  769.         bra    Prefs1
  770.  
  771. SetLFTransIn:    lea.l    LFTransText3,a0
  772.         bsr    Printer
  773.         lea.l    LFTransText2,a0
  774.         bsr    Printer
  775.         bsr    GetNSA
  776.         cmp.l    #-1,d0
  777.         beq    Prefs1
  778.         move.b    d0,LFTranslateIn
  779.         bra    Prefs1
  780.  
  781. SetLocalEcho:    lea.l    EchoText1,a0
  782.         bsr    Printer
  783.         bchg.b    #0,LocalEcho
  784.         beq    SetLocalEcho1
  785.         lea.l    EchoText3,a0
  786.         bsr    Printer
  787.         bra    Prefs1
  788. SetLocalEcho1:    lea.l    EchoText2,a0
  789.         bsr    Printer
  790.         bra    Prefs1
  791.  
  792. SetDataBits:    lea.l    DBitsText1,a0
  793.         bsr    Printer
  794.         cmp.b    #7,DataBits
  795.         beq    SetDataBits1
  796.         move.b    #7,DataBits
  797.         lea.l    DBitsText2,a0
  798.         bsr    Printer
  799.         bra    SetDataBits2
  800. SetDataBits1:    move.b    #8,DataBits
  801.         lea.l    DBitsText3,a0
  802.         bsr    Printer
  803.         bra    Prefs1
  804. SetDataBits2:    bsr    SetSerParams
  805.         tst.l    d0
  806.         beq    Prefs1
  807.         lea.l    DBitsText4,a0
  808.         bsr    Printer
  809.         bra    Prefs1
  810.  
  811. SetStopBits:    lea.l    SBitsText1,a0
  812.         bsr    Printer
  813.         cmp.b    #1,StopBits
  814.         beq    SetStopBits1
  815.         move.b    #1,StopBits
  816.         lea.l    SBitsText2,a0
  817.         bsr    Printer
  818.         bra    SetStopBits2
  819. SetStopBits1:    move.b    #2,StopBits
  820.         lea.l    SBitsText3,a0
  821.         bsr    Printer
  822.         bra    Prefs1
  823. SetStopBits2:    bsr    SetSerParams
  824.         tst.l    d0
  825.         beq    Prefs1
  826.         lea.l    SBitsText4,a0
  827.         bsr    Printer
  828.         bra    Prefs1
  829.  
  830. SetSpeed:    lea.l    SpeedText11,a0
  831.         bsr    Printer
  832. SetSpeed1:    lea.l    SpeedText1,a0
  833.         bsr    Printer
  834. SetSpeed2:    move.l    _stdin,d1
  835.         lib    Dos,FGetC
  836.         cmp.l    #-1,d0
  837.         beq    Menu
  838.         cmp.l    #'0',d0
  839.         beq    DoSpeed0
  840.         cmp.l    #'1',d0
  841.         beq    DoSpeed1
  842.         cmp.l    #'2',d0
  843.         beq    DoSpeed2
  844.         cmp.l    #'3',d0
  845.         beq    DoSpeed3
  846.         cmp.l    #'4',d0
  847.         beq    DoSpeed4
  848.         cmp.l    #'5',d0
  849.         beq    DoSpeed5
  850.         cmp.l    #'6',d0
  851.         beq    DoSpeed6
  852.         cmp.l    #'7',d0
  853.         beq    DoSpeed7
  854.         cmp.l    #'8',d0
  855.         beq    DoSpeed8
  856.         cmp.l    #'9',d0
  857.         beq    DoSpeed9
  858.         cmp.l    #'E',d0
  859.         beq    Exit1
  860.         cmp.l    #'e',d0
  861.         beq    Exit1
  862.         cmp.l    #'M',d0
  863.         beq    MainMenu
  864.         cmp.l    #'m',d0
  865.         beq    MainMenu
  866.         cmp.l    #'-',d0
  867.         beq    Prefs
  868.         bra    SetSpeed2
  869.  
  870. DoSpeed1:    move.l    #110,Speed
  871.         bra    DoSpeed_OUT
  872. DoSpeed2:    move.l    #300,Speed
  873.         bra    DoSpeed_OUT
  874. DoSpeed3:    move.l    #1200,Speed
  875.         bra    DoSpeed_OUT
  876. DoSpeed4:    move.l    #2400,Speed
  877.         bra    DoSpeed_OUT
  878. DoSpeed5:    move.l    #4800,Speed
  879.         bra    DoSpeed_OUT
  880. DoSpeed6:    move.l    #9600,Speed
  881.         bra    DoSpeed_OUT
  882. DoSpeed7:    move.l    #19200,Speed
  883.         bra    DoSpeed_OUT
  884. DoSpeed8:    move.l    #38400,Speed
  885.         bra    DoSpeed_OUT
  886. DoSpeed9:    move.l    #57600,Speed
  887.         bra    DoSpeed_OUT
  888. DoSpeed0:    move.l    #115200,Speed
  889. DoSpeed_OUT:    lea.l    SpeedText11,a0
  890.         bsr    Printer
  891.  
  892.         bsr    SetSerParams
  893.         tst.l    d0
  894.         beq    DoSpeed_OUT1
  895.  
  896.         lea.l    SpeedText12,a0
  897.         bsr    Printer
  898.         bsr    WriteDefaults
  899.         bra    SetSpeed1
  900. DoSpeed_OUT1:    bsr    WriteDefaults
  901.         bra    Prefs1
  902.  
  903. ;Dials one number. Fails for three reasons, because the user decided
  904. ;to skip this entry, to cancel dialing or to remove this entry.
  905. ;If a busy is found, a value of 1 will be returned.
  906. ;
  907. ;Inputs a0 = pointer to phonenumber (ASCII text)
  908. ;
  909. ;Result d0 = Success (0=Connect, 1=Skipped, 2=Cancelled, 3=Remove this entry)
  910. ;
  911.  
  912. DialEntry:    push    d2-d7/a2-a6
  913.         move.l    a0,a4
  914.  
  915. DialEntry1:    lea.l    DialPrefix,a1
  916.         bsr    GetLength
  917.         lea.l    DialPrefix,a0
  918.         bsr    Writer2
  919.         move.l    a4,a1
  920.         bsr    GetLength
  921.         move.l    a4,a0
  922.         bsr    Writer2
  923.         lea.l    CRLFText1,a1
  924.         bsr    GetLength
  925.         lea.l    CRLFText1,a0
  926.         bsr    Writer2
  927.         lea.l    DialingText1,a0
  928.         bsr    Printer
  929.         move.l    a4,a0
  930.         bsr    Printer
  931.         lea.l    CRLFText1,a0
  932.         bsr    Printer
  933.         move.l    #BUFLEN,d0        ;try to read ATDT etc.
  934.         move.l    #1,d1
  935.         bsr    Read
  936.  
  937. DialEntry2:    move.l    #10,d1
  938.         lib    Dos,Delay
  939.         move.l    #BUFLEN,d0
  940.         move.l    #4,d1
  941.         bsr    Read
  942.         tst.l    d0
  943.         beq    DialEntry3
  944.         lea.l    Buffer3,a0
  945.         clr.b    0(a0,d0.l)    ;null terminated, please!
  946.         move.w    #'CO',d0
  947.         lea.l    Buffer3,a0
  948.         bsr    FindWord
  949.         bne    DialEntry_OUT1
  950.         move.w    #'BU',d0
  951.         lea.l    Buffer3,a0
  952.         bsr    FindWord
  953.         bne    DialEntry4
  954.         move.w    #'NO',d0
  955.         lea.l    Buffer3,a0
  956.         bsr    FindWord
  957.         bne    DialEntry_OUT2
  958. DialEntry3:    move.l    _stdin,d1
  959.         move.l    #10000,d2
  960.         lib    Dos,WaitForChar
  961.         tst.l    d0
  962.         beq    DialEntry2
  963.         move.l    _stdin,d1
  964.         lea.l    Buffer2,a0
  965.         move.l    a0,d2
  966.         move.l    #1,d3
  967.         lib    Dos,Read
  968.         cmp.l    #1,d0
  969.         bne    DialEntry2
  970.         cmp.b    #' ',Buffer2    ;Space
  971.         beq    DialEntry_OUT2
  972.         cmp.b    #27,Buffer2    ;ESC
  973.         beq    DialEntry_OUT3
  974.         cmp.b    #8,Buffer2    ;BS
  975.         beq    DialEntry_OUT4
  976.         bra    DialEntry2
  977. DialEntry4:    lea.l    BusyText1,a0
  978.         bsr    Printer
  979.         move.l    #55,d1
  980.         lib    Dos,Delay
  981.         pull    d2-d7/a2-a6
  982.         move.l    #1,d0
  983.         rts
  984. DialEntry_OUT1:    move.l    #BUFLEN,d0        ;try to read extra stuff
  985.         move.l    #1,d1
  986.         bsr    Read
  987.         lea.l    ConnectText1,a0
  988.         bsr    Printer
  989.         pull    d2-d7/a2-a6
  990.         clr.l    d0
  991.         rts
  992. DialEntry_OUT2:    lea.l    CRLFText1,a1
  993.         bsr    GetLength
  994.         lea.l    CRLFText1,a0
  995.         bsr    Writer2
  996.         lea.l    SkippedText1,a0
  997.         bsr    Printer
  998.         move.l    #55,d1
  999.         lib    Dos,Delay
  1000.         pull    d2-d7/a2-a6
  1001.         move.l    #1,d0
  1002.         rts
  1003. DialEntry_OUT3:    lea.l    CancelledText1,a0
  1004.         bsr    Printer
  1005.         lea.l    CRLFText1,a1
  1006.         bsr    GetLength
  1007.         lea.l    CRLFText1,a0
  1008.         bsr    Writer2
  1009.         move.l    #55,d1
  1010.         lib    Dos,Delay
  1011.         pull    d2-d7/a2-a6
  1012.         move.l    #2,d0
  1013.         rts
  1014. DialEntry_OUT4:    lea.l    CRLFText1,a1
  1015.         bsr    GetLength
  1016.         lea.l    CRLFText1,a0
  1017.         bsr    Writer2
  1018.         move.l    #55,d1
  1019.         lib    Dos,Delay
  1020.         lea.l    RemoveText1,a0
  1021.         bsr    Printer
  1022.         pull    d2-d7/a2-a6
  1023.         move.l    #3,d0
  1024.         rts
  1025.  
  1026. Break:        lea.l    BreakText1,a0
  1027.         bsr    Printer
  1028.         clr.l    d0
  1029.         rts
  1030.  
  1031. ClearSer:    move.l    IORRequest,a1
  1032.         lib    Exec,CheckIO
  1033.         tst.l    d0
  1034.         beq    ClearSer1
  1035.         move.l    IORRequest,a1
  1036.         lib    Exec,WaitIO
  1037.         rts
  1038.  
  1039. ClearSer1:    move.l    IORRequest,a1
  1040.         ABORTIO
  1041.         move.l    IORRequest,a1
  1042.         lib    Exec,WaitIO
  1043.         rts
  1044.  
  1045. ;Buffered read from a device
  1046. ;
  1047. ;Inputs d0 = Buffer length (maximum amount to read)
  1048. ;    d1 = Minimum amout to read
  1049. ;
  1050. ;Result d0 = Amount actually read
  1051. ;
  1052.  
  1053. Read:        push    d2-d7/a2-a6
  1054.         move.l    d0,d4
  1055.         move.l    d1,d5
  1056.  
  1057.         move.l    IOWRequest,a1            ;get amount of bytes
  1058.         move.w    #SDCMD_QUERY,IO_COMMAND(a1)    ;in buffer
  1059.         or.b    #IOF_QUICK,IO_FLAGS(a1)
  1060.         lib    Exec,DoIO
  1061.  
  1062.         move.l    IOWRequest,a1
  1063.         move.l    IO_ACTUAL(a1),d0
  1064.         beq    Read_OUT1
  1065.         cmp.l    d5,d0
  1066.         bmi    Read_OUT1
  1067.         cmp.l    d4,d0
  1068.         bls    Read1
  1069.         move.l    d4,d0            ;available > buffer size
  1070. Read1:        move.l    IORRequest,a1
  1071.         move.l    d0,IO_LENGTH(a1)
  1072.         BEGINIO
  1073.  
  1074.         bsr    WriteDefaults
  1075.         move.l    IORRequest,a1
  1076.         move.l    IO_ACTUAL(a1),d0    ;even on error we return
  1077.         add.l    d0,Received        ;correct amount in buffer
  1078.         pull    d2-d7/a2-a6
  1079.         rts
  1080.  
  1081. Read_OUT1:    bsr    WriteDefaults
  1082.         clr.l    d0
  1083.         pull    d2-d7/a2-a6
  1084.         rts
  1085.  
  1086. Writer:        add.l    #1,Sent
  1087.         move.l    IOWRequest,a1
  1088.         lib    Exec,DoIO        ;May freeze, too bad
  1089.         rts
  1090.  
  1091. ;Writes string to serial port
  1092. ;
  1093. ;D0 = Length
  1094. ;A0 = String
  1095.  
  1096. Writer2:    add.l    d0,Sent
  1097.         move.l    IOWRequest,a1
  1098.         move.w    #CMD_WRITE,IO_COMMAND(a1)
  1099.         move.l    d0,IO_LENGTH(a1)
  1100.         move.l    a0,IO_DATA(a1)
  1101.         lib    Exec,DoIO        ;May freeze, too bad
  1102.         bsr    WriteDefaults
  1103.         rts
  1104.  
  1105. ;Reset back to default...
  1106.  
  1107. WriteDefaults:    move.l    IOWRequest,a1
  1108.         move.w    #CMD_WRITE,IO_COMMAND(a1)
  1109.         move.l    #1,IO_LENGTH(a1)        ;writes in one byte "chunks"
  1110.         lea.l    Buffer1,a0
  1111.         move.l    a0,IO_DATA(a1)
  1112.         rts
  1113.  
  1114. SetSerParams:    move.l    IOWRequest,a1
  1115.         clr.l    IO_LENGTH(a1)
  1116.         clr.l    IO_DATA(a1)
  1117.         move.w    #SDCMD_SETPARAMS,IO_COMMAND(a1)
  1118.         move.l    Speed,IO_BAUD(a1)
  1119.         move.b    DataBits,IO_READLEN(a1)
  1120.         move.b    DataBits,IO_WRITELEN(a1)
  1121.         move.b    StopBits,IO_STOPBITS(a1)
  1122.         lib    Exec,DoIO
  1123.         rts
  1124.  
  1125. DoCLIInput:    lea.l    Buffer1,a0
  1126.         cmp.b    #CR,Buffer1
  1127.         beq    DoCLIInput3
  1128.         cmp.b    #LF,Buffer1
  1129.         beq    DoCLIInput4
  1130. DoCLIInput1:    bsr    Writer
  1131.         btst.b    #0,LocalEcho
  1132.         beq    DoCLIInput2
  1133.         lea.l    Buffer1,a0
  1134.         bsr    Printer
  1135. DoCLIInput2:    rts
  1136. DoCLIInput3:    tst.b    CRTranslate
  1137.         beq    DoCLIInput1
  1138.         cmp.b    #1,CRTranslate
  1139.         beq    DoCLIInput2
  1140.         cmp.b    #2,CRTranslate
  1141.         bne    DoCLIInput2
  1142.         bsr    DoCLIInput1
  1143.         move.b    #LF,Buffer1
  1144.         bra    DoCLIInput1
  1145. DoCLIInput4:    tst.b    LFTranslate
  1146.         beq    DoCLIInput1
  1147.         cmp.b    #1,LFTranslate
  1148.         beq    DoCLIInput2
  1149.         cmp.b    #2,LFTranslate
  1150.         bne    DoCLIInput2
  1151.         move.b    #CR,Buffer1
  1152.         bsr    DoCLIInput1
  1153.         move.b    #LF,Buffer1
  1154.         bra    DoCLIInput1
  1155.  
  1156. DoSerialInput:    push    d0-d7/a2-a6
  1157.         lea.l    Buffer3,a0
  1158.         lea.l    Buffer4,a1
  1159. DoSerialInput1:    tst.b    (a0)
  1160.         beq    DoSerialInput3.1
  1161.         cmp.b    #CR,(a0)
  1162.         beq    DoSerialInput4
  1163.         cmp.b    #LF,(a0)
  1164.         beq    DoSerialInput6
  1165. DoSerialInput2:    move.b    (a0)+,(a1)+
  1166.         bra    DoSerialInput1
  1167. DoSerialInput3:    pull    d0-d7/a2-a6
  1168.         rts
  1169. DoSerialInput3.1: clr.b    (a1)
  1170.         pull    d0-d7/a2-a6
  1171.         rts
  1172. DoSerialInput4:    tst.b    CRTranslateIn
  1173.         beq    DoSerialInput2
  1174.         cmp.b    #1,CRTranslateIn
  1175.         bne    DoSerialInput5
  1176.         add.l    #1,a0
  1177.         bra    DoSerialInput1
  1178. DoSerialInput5:    cmp.b    #2,CRTranslateIn
  1179.         bne    DoSerialInput2
  1180.         move.b    #CR,(a1)+
  1181.         move.b    #LF,(a1)+
  1182.         add.l    #1,a0
  1183.         bra    DoSerialInput1
  1184. DoSerialInput6:    tst.b    LFTranslateIn
  1185.         beq    DoSerialInput2
  1186.         cmp.b    #1,LFTranslateIn
  1187.         bne    DoSerialInput7
  1188.         add.l    #1,a0
  1189.         bra    DoSerialInput1
  1190. DoSerialInput7:    cmp.b    #2,LFTranslateIn
  1191.         bne    DoSerialInput2
  1192.         move.b    #CR,(a1)+
  1193.         move.b    #LF,(a1)+
  1194.         add.l    #1,a0
  1195.         bra    DoSerialInput1
  1196.  
  1197. ;gets anykey from user
  1198. ;
  1199. ;Results d0 = -1 for error, otherwise d0 = key pressed
  1200.  
  1201. GetAnyKey:    lea.l    AnyKeyText1,a0
  1202.         bsr    Printer
  1203.         move.l    _stdin,d1
  1204.         lib    Dos,Flush
  1205.         move.l    _stdin,d1
  1206.         lib    Dos,FGetC
  1207.         lea.l    CRLFText1,a0
  1208.         bsr    Printer
  1209.         rts
  1210.  
  1211. ;gets input from user
  1212. ;
  1213. ;Results d0 = 0 for N, 1 for S, 2 for A, -1 for error
  1214.  
  1215. GetNSA:        move.l    _stdin,d1
  1216.         lib    Dos,FGetC
  1217.         cmp.l    #-1,d0
  1218.         beq    GetNSA_ERR1
  1219.         cmp.l    #'n',d0
  1220.         beq    GetNSA1
  1221.         cmp.l    #'N',d0
  1222.         beq    GetNSA1
  1223.         cmp.l    #'s',d0
  1224.         beq    GetNSA2
  1225.         cmp.l    #'S',d0
  1226.         beq    GetNSA2
  1227.         cmp.l    #'a',d0
  1228.         beq    GetNSA3
  1229.         cmp.l    #'A',d0
  1230.         beq    GetNSA3
  1231.         cmp.l    #CR,d0
  1232.         beq    GetNSA_ERR1
  1233.         cmp.l    #LF,d0
  1234.         beq    GetNSA_ERR1
  1235.         bra    GetNSA
  1236. GetNSA1:    lea.l    NoneText1,a0
  1237.         bsr    Printer
  1238.         move.l    #0,d0
  1239.         rts
  1240. GetNSA2:    lea.l    StripText1,a0
  1241.         bsr    Printer
  1242.         move.l    #1,d0
  1243.         rts
  1244. GetNSA3:    lea.l    AddText1,a0
  1245.         bsr    Printer
  1246.         move.l    #2,d0
  1247.         rts
  1248. GetNSA_ERR1:    move.l    #-1,d0
  1249.         rts
  1250.  
  1251. ;Give NSA
  1252. ;
  1253. ;Inputs d0 = NSA qualifier(?)
  1254. ;
  1255.  
  1256. GiveNSA:    tst.b    d0
  1257.         beq    GiveNSA1
  1258.         cmp.b    #1,d0
  1259.         beq    GiveNSA2
  1260.         cmp.b    #2,d0
  1261.         beq    GiveNSA3
  1262.         lea.l    NAText1,a0
  1263.         bsr    Printer
  1264.         rts
  1265. GiveNSA1:    lea.l    NText1,a0
  1266.         bsr    Printer
  1267.         rts
  1268. GiveNSA2:    lea.l    SText1,a0
  1269.         bsr    Printer
  1270.         rts
  1271. GiveNSA3:    lea.l    AText1,a0
  1272.         bsr    Printer
  1273.         rts
  1274.  
  1275. Nope:        lea.l    SpaceText1,a0
  1276.         bsr    Printer
  1277.         rts
  1278. Yep:        lea.l    StarText1,a0
  1279.         bsr    Printer
  1280.         rts
  1281.  
  1282. GiveSettings:    lea.l    fstrl3,a0        ;HEX->ASCII
  1283.         lea.l    Speed,a1        ;Number2Print
  1284.         lea.l    PutChProc,a2
  1285.         lea.l    SpeedText90,a3        ;Destination
  1286.         lib    Exec,RawDoFmt
  1287.  
  1288.         lea.l    CurrentText1,a0
  1289.         bsr    Printer
  1290.  
  1291.         tst.l    Speed
  1292.         beq    GiveSettings0.1
  1293.         lea.l    SpeedText90,a0
  1294.         bsr    Printer
  1295.         bra    GiveSettings0.2
  1296.  
  1297. GiveSettings0.1: lea.l    DefText1,a0
  1298.         bsr    Printer
  1299.  
  1300. GiveSettings0.2: lea.l    CurrentText2,a0
  1301.         bsr    Printer
  1302.  
  1303.         tst.w    LocalEcho
  1304.         bne    GiveSettings1
  1305.         bsr    Nope
  1306.         bra    GiveSettings2
  1307. GiveSettings1:    bsr    Yep
  1308.  
  1309. GiveSettings2:    lea.l    CurrentText7,a0
  1310.         bsr    Printer
  1311.  
  1312.         lea.l    CurrentText3,a0
  1313.         bsr    Printer
  1314.  
  1315.         move.b    CRTranslate,d0
  1316.         bsr    GiveNSA
  1317.  
  1318.         lea.l    CurrentText4,a0
  1319.         bsr    Printer
  1320.  
  1321.         move.b    LFTranslate,d0
  1322.         bsr    GiveNSA
  1323.  
  1324.         lea.l    CurrentText7,a0
  1325.         bsr    Printer
  1326.  
  1327.         lea.l    CurrentText5,a0
  1328.         bsr    Printer
  1329.  
  1330.         move.b    CRTranslateIn,d0
  1331.         bsr    GiveNSA
  1332.  
  1333.         lea.l    CurrentText6,a0
  1334.         bsr    Printer
  1335.  
  1336.         move.b    LFTranslateIn,d0
  1337.         bsr    GiveNSA
  1338.  
  1339.         lea.l    CurrentText7,a0
  1340.         bsr    Printer
  1341.  
  1342.         lea.l    CurrentText8,a0
  1343.         bsr    Printer
  1344.  
  1345.         cmp.b    #7,DataBits
  1346.         bne    GiveSettings3
  1347.         lea.l    SevenText1,a0
  1348.         bsr    Printer
  1349.         bra    GiveSettings4
  1350. GiveSettings3:    cmp.b    #8,DataBits
  1351.         bne    GiveSettings3.1
  1352.         lea.l    EightText1,a0
  1353.         bsr    Printer
  1354.         bra    GiveSettings4
  1355. GiveSettings3.1: lea.l    DefText1,a0
  1356.         bsr    Printer
  1357.  
  1358. GiveSettings4:    lea.l    CurrentText9,a0
  1359.         bsr    Printer
  1360.  
  1361.         cmp.b    #1,StopBits
  1362.         bne    GiveSettings5
  1363.         lea.l    OneText1,a0
  1364.         bsr    Printer
  1365.         bra    GiveSettings6
  1366. GiveSettings5:    cmp.b    #2,StopBits
  1367.         bne    GiveSettings5.1
  1368.         lea.l    TwoText1,a0
  1369.         bsr    Printer
  1370.         bra    GiveSettings6
  1371. GiveSettings5.1: lea.l    DefText1,a0
  1372.         bsr    Printer
  1373.  
  1374. GiveSettings6:    lea.l    CurrentText7,a0
  1375.         bsr    Printer
  1376.  
  1377.         rts
  1378.  
  1379. GiveStats:    lea.l    fstrl1,a0        ;HEX->ASCII
  1380.         lea.l    Received,a1        ;Number2Print
  1381.         lea.l    PutChProc,a2
  1382.         lea.l    ReceivedText1,a3    ;Destination
  1383.         lib    Exec,RawDoFmt
  1384.  
  1385.         lea.l    fstrl2,a0        ;HEX->ASCII
  1386.         lea.l    Sent,a1            ;Number2Print
  1387.         lea.l    PutChProc,a2
  1388.         lea.l    SentText1,a3        ;Destination
  1389.         lib    Exec,RawDoFmt
  1390.  
  1391.         lea.l    StatsText1,a0
  1392.         bsr    Printer
  1393.         lea.l    ReceivedText1,a0
  1394.         bsr    Printer
  1395.         lea.l    SentText1,a0
  1396.         bsr    Printer
  1397.         lea.l    CRLFText1,a0
  1398.         bsr    Printer
  1399.         rts
  1400.  
  1401. PrintEntries:    tst.b    DialPrefix
  1402.         beq    PrintEntries1
  1403.         lea.l    PrefixText1,a0
  1404.         bsr    Printer
  1405.         lea.l    DialPrefix,a0
  1406.         bsr    Printer
  1407.         lea.l    CRLFText1,a0
  1408.         bsr    Printer
  1409. PrintEntries1:    tst.b    Entry1
  1410.         beq    PrintEntries2
  1411.         lea.l    EntryText1,a0
  1412.         bsr    Printer
  1413.         lea.l    Entry1,a0
  1414.         bsr    Printer
  1415.         lea.l    CRLFText1,a0
  1416.         bsr    Printer
  1417. PrintEntries2:    tst.b    Entry2
  1418.         beq    PrintEntries3
  1419.         lea.l    EntryText2,a0
  1420.         bsr    Printer
  1421.         lea.l    Entry2,a0
  1422.         bsr    Printer
  1423.         lea.l    CRLFText1,a0
  1424.         bsr    Printer
  1425. PrintEntries3:    tst.b    Entry3
  1426.         beq    PrintEntries4
  1427.         lea.l    EntryText3,a0
  1428.         bsr    Printer
  1429.         lea.l    Entry3,a0
  1430.         bsr    Printer
  1431.         lea.l    CRLFText1,a0
  1432.         bsr    Printer
  1433. PrintEntries4:    tst.b    Entry4
  1434.         beq    PrintEntries5
  1435.         lea.l    EntryText4,a0
  1436.         bsr    Printer
  1437.         lea.l    Entry4,a0
  1438.         bsr    Printer
  1439.         lea.l    CRLFText1,a0
  1440.         bsr    Printer
  1441. PrintEntries5:    tst.b    Entry5
  1442.         beq    PrintEntries6
  1443.         lea.l    EntryText5,a0
  1444.         bsr    Printer
  1445.         lea.l    Entry5,a0
  1446.         bsr    Printer
  1447.         lea.l    CRLFText1,a0
  1448.         bsr    Printer
  1449. PrintEntries6:    tst.b    Entry6
  1450.         beq    PrintEntries7
  1451.         lea.l    EntryText6,a0
  1452.         bsr    Printer
  1453.         lea.l    Entry6,a0
  1454.         bsr    Printer
  1455.         lea.l    CRLFText1,a0
  1456.         bsr    Printer
  1457. PrintEntries7:    tst.b    Entry7
  1458.         beq    PrintEntries8
  1459.         lea.l    EntryText7,a0
  1460.         bsr    Printer
  1461.         lea.l    Entry7,a0
  1462.         bsr    Printer
  1463.         lea.l    CRLFText1,a0
  1464.         bsr    Printer
  1465. PrintEntries8:    tst.b    Entry8
  1466.         beq    PrintEntries9
  1467.         lea.l    EntryText8,a0
  1468.         bsr    Printer
  1469.         lea.l    Entry8,a0
  1470.         bsr    Printer
  1471.         lea.l    CRLFText1,a0
  1472.         bsr    Printer
  1473. PrintEntries9:    tst.b    Entry9
  1474.         beq    PrintEntries10
  1475.         lea.l    EntryText9,a0
  1476.         bsr    Printer
  1477.         lea.l    Entry9,a0
  1478.         bsr    Printer
  1479.         lea.l    CRLFText1,a0
  1480.         bsr    Printer
  1481. PrintEntries10:    tst.b    Entry10
  1482.         beq    PrintEntries11
  1483.         lea.l    EntryText10,a0
  1484.         bsr    Printer
  1485.         lea.l    Entry10,a0
  1486.         bsr    Printer
  1487.         lea.l    CRLFText1,a0
  1488.         bsr    Printer
  1489. PrintEntries11:    rts
  1490.  
  1491. PrintSelect:    lea.l    SelectedText1,a0
  1492.         bsr    Printer
  1493.         lea.l    SelectText1,a0
  1494.         bsr    Printer
  1495.         tst.b    EntrySelected1
  1496.         beq    PrintSelect1
  1497.         lea.l    SelectText11,a0
  1498.         bsr    Printer
  1499.         bra    PrintSelect2
  1500. PrintSelect1:    lea.l    SelectText12,a0
  1501.         bsr    Printer
  1502. PrintSelect2:    lea.l    SelectText2,a0
  1503.         bsr    Printer
  1504.         tst.b    EntrySelected2
  1505.         beq    PrintSelect3
  1506.         lea.l    SelectText11,a0
  1507.         bsr    Printer
  1508.         bra    PrintSelect4
  1509. PrintSelect3:    lea.l    SelectText12,a0
  1510.         bsr    Printer
  1511. PrintSelect4:    lea.l    SelectText3,a0
  1512.         bsr    Printer
  1513.         tst.b    EntrySelected3
  1514.         beq    PrintSelect5
  1515.         lea.l    SelectText11,a0
  1516.         bsr    Printer
  1517.         bra    PrintSelect6
  1518. PrintSelect5:    lea.l    SelectText12,a0
  1519.         bsr    Printer
  1520. PrintSelect6:    lea.l    SelectText4,a0
  1521.         bsr    Printer
  1522.         tst.b    EntrySelected4
  1523.         beq    PrintSelect7
  1524.         lea.l    SelectText11,a0
  1525.         bsr    Printer
  1526.         bra    PrintSelect8
  1527. PrintSelect7:    lea.l    SelectText12,a0
  1528.         bsr    Printer
  1529. PrintSelect8:    lea.l    SelectText5,a0
  1530.         bsr    Printer
  1531.         tst.b    EntrySelected5
  1532.         beq    PrintSelect9
  1533.         lea.l    SelectText11,a0
  1534.         bsr    Printer
  1535.         bra    PrintSelect10
  1536. PrintSelect9:    lea.l    SelectText12,a0
  1537.         bsr    Printer
  1538. PrintSelect10:    lea.l    SelectText6,a0
  1539.         bsr    Printer
  1540.         tst.b    EntrySelected6
  1541.         beq    PrintSelect11
  1542.         lea.l    SelectText11,a0
  1543.         bsr    Printer
  1544.         bra    PrintSelect12
  1545. PrintSelect11:    lea.l    SelectText12,a0
  1546.         bsr    Printer
  1547. PrintSelect12:    lea.l    SelectText7,a0
  1548.         bsr    Printer
  1549.         tst.b    EntrySelected7
  1550.         beq    PrintSelect13
  1551.         lea.l    SelectText11,a0
  1552.         bsr    Printer
  1553.         bra    PrintSelect14
  1554. PrintSelect13:    lea.l    SelectText12,a0
  1555.         bsr    Printer
  1556. PrintSelect14:    lea.l    SelectText8,a0
  1557.         bsr    Printer
  1558.         tst.b    EntrySelected8
  1559.         beq    PrintSelect15
  1560.         lea.l    SelectText11,a0
  1561.         bsr    Printer
  1562.         bra    PrintSelect16
  1563. PrintSelect15:    lea.l    SelectText12,a0
  1564.         bsr    Printer
  1565. PrintSelect16:    lea.l    SelectText9,a0
  1566.         bsr    Printer
  1567.         tst.b    EntrySelected9
  1568.         beq    PrintSelect17
  1569.         lea.l    SelectText11,a0
  1570.         bsr    Printer
  1571.         bra    PrintSelect18
  1572. PrintSelect17:    lea.l    SelectText12,a0
  1573.         bsr    Printer
  1574. PrintSelect18:    lea.l    SelectText0,a0
  1575.         bsr    Printer
  1576.         tst.b    EntrySelected0
  1577.         beq    PrintSelect19
  1578.         lea.l    SelectText13,a0
  1579.         bsr    Printer
  1580.         bra    PrintSelect20
  1581. PrintSelect19:    lea.l    SelectText14,a0
  1582.         bsr    Printer
  1583. PrintSelect20:    lea.l    CRLFText1,a0
  1584.         bsr    Printer
  1585.         rts
  1586.  
  1587. DoPhoneBook:    lea.l    PhoneBookName,a0
  1588.         move.l    a0,d1
  1589.         move.l    #MODE_OLDFILE,d2
  1590.         lib    Dos,Open
  1591.         move.l    d0,PhoneFile
  1592.         bne    DoPhoneBook1
  1593.  
  1594.         lea.l    FileErrorText1,a0
  1595.         bsr    Printer
  1596.         bra    DoPBook_ERR1
  1597.  
  1598. DoPhoneBook1:    move.l    PhoneFile,d1
  1599.         lea.l    LoadBuffer1,a0
  1600.         move.l    a0,d2
  1601.         move.l    #4,d3
  1602.         lib    Dos,Read
  1603.         cmp.l    #4,d0
  1604.         beq    DoPhoneBook2
  1605.  
  1606.         lea.l    FileErrorText2,a0
  1607.         bsr    Printer
  1608.         bra    DoPBook_ERR1
  1609.  
  1610. DoPhoneBook2:    cmp.l    #'#ST#',LoadBuffer1
  1611.         beq    DoPhoneBook3
  1612.  
  1613.         lea.l    FileErrorText3,a0
  1614.         bsr    Printer
  1615.         bra    DoPBook_ERR1
  1616.  
  1617. DoPhoneBook3:    move.l    PhoneFile,d1
  1618.         bsr    GetFileLength
  1619.         move.l    d0,PhoneLength
  1620.         beq    DoPBook_OUT
  1621.  
  1622.         move.l    PhoneLength,d0
  1623.         move.l    #MEMF_CLEAR!MEMF_PUBLIC,d1    ;Type of memory wanted
  1624.         lib    Exec,AllocMem
  1625.         move.l    d0,PhoneMem
  1626.         bne    DoPhoneBook4
  1627.  
  1628.         lea.l    MemErrorText1,a0
  1629.         bsr    Printer
  1630.         bra    DoPBook_ERR2
  1631.  
  1632. DoPhoneBook4:    move.l    PhoneFile,d1
  1633.         move.l    PhoneMem,d2
  1634.         move.l    PhoneLength,d3
  1635.         lib    Dos,Read
  1636.         cmp.l    PhoneLength,d0
  1637.         beq    DoPhoneBook5
  1638.  
  1639.         lea.l    FileErrorText2,a0
  1640.         bsr    Printer
  1641.         bra    DoPBook_ERR2
  1642.  
  1643. DoPhoneBook5:    move.l    PhoneMem,a0
  1644.         bsr    GetLLength
  1645.         add.l    d1,a0        ;skip identifier (#ST#)
  1646.         lea.l    DialPrefix,a1
  1647.         bsr    Parse
  1648.         lea.l    Entry1,a1
  1649.         bsr    Parse
  1650.         lea.l    Entry2,a1
  1651.         bsr    Parse
  1652.         lea.l    Entry3,a1
  1653.         bsr    Parse
  1654.         lea.l    Entry4,a1
  1655.         bsr    Parse
  1656.         lea.l    Entry5,a1
  1657.         bsr    Parse
  1658.         lea.l    Entry6,a1
  1659.         bsr    Parse
  1660.         lea.l    Entry7,a1
  1661.         bsr    Parse
  1662.         lea.l    Entry8,a1
  1663.         bsr    Parse
  1664.         lea.l    Entry9,a1
  1665.         bsr    Parse
  1666.         lea.l    Entry10,a1
  1667.         bsr    Parse
  1668.  
  1669. DoPBook_OUT:    bsr    KillPFile
  1670.         bsr    KillPMem
  1671.         move.l    #-1,d0
  1672.         rts
  1673. DoPBook_ERR1:    clr.l    d0
  1674.         rts
  1675. DoPBook_ERR2:    bsr    KillPFile
  1676.         bsr    KillPMem
  1677.         clr.l    d0
  1678.         rts
  1679.  
  1680. KillPFile:    move.l    PhoneFile,d1
  1681.         beq    KillPFile1
  1682.         lib    Dos,Close
  1683.         clr.l    PhoneFile
  1684. KillPFile1:    rts
  1685.  
  1686. KillPMem:    tst.l    PhoneMem
  1687.         beq    KillPMem1
  1688.         move.l    PhoneMem,a1
  1689.         move.l    PhoneLength,d0
  1690.         lib    Exec,FreeMem
  1691.         clr.l    PhoneMem
  1692.         clr.l    PhoneLength
  1693. KillPMem1:    rts
  1694.  
  1695. ShutDown:    tst.w    SerOpen
  1696.         beq    ShutDown9000
  1697.         bsr    ClearSer
  1698.         move.l    IORRequest,a1
  1699.         lib    Exec,CloseDevice
  1700.  
  1701. ShutDown9000:    move.l    IORRequest,a0
  1702.         lib    Exec,DeleteIORequest
  1703.  
  1704.         move.l    SRRPort,a0
  1705.         lib    Exec,DeleteMsgPort
  1706.  
  1707.         move.l    IOWRequest,a0
  1708.         lib    Exec,DeleteIORequest
  1709.  
  1710.         move.l    SWRPort,a0
  1711.         lib    Exec,DeleteMsgPort
  1712.  
  1713.         move.l    _stdin,d1
  1714.         beq    ShutDown8000
  1715.         move.l    #FALSE,d2
  1716.         lib    Dos,SetMode
  1717.  
  1718. ShutDown8000:    bsr    KillPFile
  1719.         bsr    KillPMem
  1720. ShutDown7000:
  1721. ShutDown1000:    closlib    Dos
  1722.         pull    d2-d7/a2-a6
  1723.         clr.l    d0
  1724.         rts
  1725.  
  1726. ;CheckEvent waits for messages from serial.device
  1727.  
  1728. CheckEvent:    clr.l    d0
  1729.         clr.l    d1
  1730.         move.l    SRRPort,a1        ;serial.device
  1731.         move.l    a1,a2
  1732.         move.b    MP_SIGBIT(a1),d1
  1733.         bset.l    d1,d0
  1734.         lib    Exec,Wait
  1735.  
  1736. C2GetMsg2:    move.l    #-1,d0
  1737.         rts
  1738.  
  1739. ;Get length of text in given address
  1740. ;
  1741. ;Input a1 = Address of null terminated text string
  1742. ;
  1743. ;Result d0 = Length
  1744.  
  1745. GetLength:    clr.l    d0
  1746.         cmp.l    #$00,a1        ;fixes enforcer hit
  1747.         beq    GetLength_OUT
  1748. GetLength2:    add.l    #1,d0
  1749.         tst.b    (a1)+
  1750.         bne    GetLength2
  1751.         sub.l    #1,d0        ;don't include NULL
  1752. GetLength_OUT:    rts
  1753.  
  1754.  
  1755. ;Get line length of text in given address, including LF
  1756. ;
  1757. ;Input a0 = Address of LF terminated text string
  1758. ;
  1759. ;Result d1 = Length
  1760.  
  1761. GetLLength:    push    a0
  1762.         clr.l    d1
  1763.         cmp.l    #$00,a0        ;fixes enforcer hit
  1764.         beq    GetLLength_OUT
  1765. GetLLength2:    add.l    #1,d1
  1766.         cmp.b    #10,(a0)+
  1767.         bne    GetLLength2
  1768. GetLLength_OUT:    pull    a0
  1769.         rts
  1770.  
  1771. ;Gets the length of the file given
  1772. ;
  1773. ;Input d1 = File
  1774. ;
  1775. ;Result d0 = Length of file in bytes
  1776. ;
  1777.  
  1778. GetFileLength:    push    d5-d6
  1779.         move.l    d1,d6
  1780.         move.l    #00,d2
  1781.         move.l    #01,d3
  1782.         lib    Dos,Seek
  1783.         move.l    d6,d1
  1784.         lib    Dos,Seek
  1785.  
  1786.         move.l    d0,d5
  1787.         move.l    d6,d1
  1788.         move.l    #0,d2
  1789.         move.l    #-1,d3
  1790.         lib    Dos,Seek
  1791.  
  1792.         move.l    d5,d0
  1793.         pull    d5-d6
  1794.         rts
  1795.  
  1796. ;Parses string to given address. Removes spaces, tabs, CRs and comments.
  1797. ;Quits on LF or NULL.
  1798. ;
  1799. ;Inputs a0 = pointer to string to parse (source)
  1800. ;       a1 = buffer to store parsed data (destination)
  1801. ;       d0 = maximum length of output
  1802. ;
  1803. ;Results a0 = pointer with start of next data to parse
  1804. ;             i.e. pointer to data after LF or NULL
  1805. ;
  1806.  
  1807. Parse:        tst.b    (a0)        
  1808.         beq    Parse_OUT1
  1809.         cmp.b    #' ',(a0)    ;Space
  1810.         beq    ParseSkipC
  1811.         cmp.b    #9,(a0)        ;TAB
  1812.         beq    ParseSkipC
  1813.         cmp.b    #';',(a0)    ;Comment
  1814.         beq    ParseSkipL
  1815.         cmp.b    #CR,(a0)    ;CR
  1816.         beq    ParseSkipC
  1817.         cmp.b    #LF,(a0)    ;LF
  1818.         beq    Parse_OUT1
  1819.         move.b    (a0)+,(a1)+    ;copy char
  1820.         sub.l    #1,d0
  1821.         beq    Parse_OUT
  1822.         bra    Parse
  1823. ParseSkipC:    add.l    #1,a0
  1824.         bra    Parse
  1825. ParseSkipL:    bsr    GetLLength
  1826.         add.l    d1,a0
  1827. Parse_OUT:    rts
  1828. Parse_OUT1:    add.l    #1,a0
  1829.         rts
  1830.  
  1831. ;Finds a string in another string
  1832. ;
  1833. ;Inputs    a0 = Pointer to string1 (from what to find)
  1834. ;    d0 = Word (what to search for)
  1835. ;
  1836. ;Result    d0 = 0 if not found
  1837.  
  1838. FindWord:    tst.b    (a0)
  1839.         beq    FindWord1
  1840.         cmp.w    (a0),d0
  1841.         beq    FindWord2
  1842.         add.l    #1,a0
  1843.         bra    FindWord
  1844. FindWord1:    clr.l    d0        ;keep right before rts
  1845.         rts
  1846. FindWord2:    move.l    #-1,d0        ;keep right before rts
  1847.         rts
  1848.  
  1849. ConvASCII:    clr.l    d0
  1850.         clr.l    d1
  1851.         cmp.b    #' ',(a0)
  1852.         bne    ConvASCII2
  1853.         add.l    #1,a0
  1854. ConvASCII2:    move.b    (a0),d1
  1855.         cmp.b    #'0',d1
  1856.         bcs    ConvASCII_OUT
  1857.         cmp.b    #'9',d1
  1858.         bhi    ConvASCII_OUT
  1859.         sub.b    #'0',d1
  1860.         mulu.w    #10,d0
  1861.         add.l    d1,d0
  1862.         add.l    #1,a0
  1863.         bra    ConvASCII2
  1864. ConvASCII_OUT:    rts
  1865.  
  1866. ;Error etc. messages
  1867.  
  1868. Usage:        lea.l    UsageText1,a0
  1869.         bsr    Printer
  1870.         bra    ShutDown
  1871.  
  1872. NoDos:        add.l    #8,sp
  1873.         pull    d2-d7/a2-a6
  1874.         move.l    #RETURN_FAIL,d0
  1875.         rts
  1876.  
  1877. NotInteractive:    add.l    #8,sp
  1878.         lea.l    NotIntText1,a0
  1879.         bsr    Printer
  1880.         bra    ShutDown
  1881.  
  1882. NoMsgPort:    lea.l    NoMsgPortText1,a0
  1883.         bsr    Printer
  1884.         bra    ShutDown
  1885.  
  1886. NoIOReq:    lea.l    NoIOReqText1,a0
  1887.         bsr    Printer
  1888.         bra    ShutDown
  1889.  
  1890. NoSerial:    lea.l    NoSerialText1,a0
  1891.         bsr    Printer
  1892.         move.l    SerName,a0
  1893.         bsr    Printer
  1894.         lea.l    NoSerialText2,a0
  1895.         bsr    Printer
  1896.         bra    ShutDown
  1897.  
  1898. Printer:    printa    a0,_stdout
  1899.         rts
  1900.  
  1901. PutChProc:    tst.b    d0
  1902.         beq    PutChProc_OUT
  1903.         move.b    d0,(a3)+
  1904. PutChProc_OUT:    rts
  1905.  
  1906. ;Structures
  1907.  
  1908. ;lib stuff
  1909.  
  1910.         libnames
  1911.  
  1912. ;Other stuff, part I
  1913.  
  1914. OurTask:    dc.l    0
  1915. SRRPort:    dc.l    0
  1916. IORRequest:    dc.l    0
  1917. SWRPort:    dc.l    0
  1918. IOWRequest:    dc.l    0
  1919. _stdout:    dc.l    0
  1920. _stdin:        dc.l    0
  1921. BufCount:    dc.l    0
  1922. Sent:        dc.l    0            ;Count sent chars
  1923. Received:    dc.l    0            ;Count reveived chars
  1924. PhoneFile:    dc.l    0
  1925. PhoneLength:    dc.l    0
  1926. PhoneMem:    dc.l    0
  1927.  
  1928. ;Other stuff part II
  1929.  
  1930. EntrySelected1:    dc.b    0
  1931. EntrySelected2:    dc.b    0
  1932. EntrySelected3:    dc.b    0
  1933. EntrySelected4:    dc.b    0
  1934. EntrySelected5:    dc.b    0
  1935. EntrySelected6:    dc.b    0
  1936. EntrySelected7:    dc.b    0
  1937. EntrySelected8:    dc.b    0
  1938. EntrySelected9:    dc.b    0
  1939. EntrySelected0:    dc.b    0
  1940. Speed:        dc.l    0
  1941. LocalEcho:    dc.w    0        ;bit 0 (0=no echo, 1=echo)
  1942. CRTranslate:    dc.b    0        ;0=none, 1=strip, 2=add LF
  1943. LFTranslate:    dc.b    0        ;0=none, 1=strip, 2=add CR
  1944. CRTranslateIn:    dc.b    0        ;0=none, 1=strip, 2=add LF
  1945. LFTranslateIn:    dc.b    0        ;0=none, 1=strip, 2=add CR
  1946. DataBits:    dc.b    8
  1947. StopBits:    dc.b    1
  1948.  
  1949. ;Serial device stuff
  1950.  
  1951. SerName:    dc.l    SerName2        ;A pointer!
  1952. SerUnit:    dc.l    0
  1953. SerOpen:    dc.w    0
  1954.  
  1955. ;Strings, error
  1956.  
  1957. BreakText1:    dc.b    "***Break",10,0
  1958. NotIntText1:    dc.b    "ERROR: Please don't redirect input!",10,0
  1959. NoMsgPortText1:    dc.b    "ERROR: Couldn't get message port!",10,0
  1960. NoIOReqText1:    dc.b    "ERROR: Couldn't get SerialIOReq!",10,0
  1961. NoSerialText1:    dc.b    "ERROR: Couldn't open ",0
  1962. SerName2:    dc.b    "serial.device",0
  1963. NoSerialText2:    dc.b    10,0
  1964. FileErrorText1:    dc.b    "ERROR: Couldn't open S:ShellTerm.phone",13,10,0
  1965. FileErrorText2:    dc.b    "ERROR: Couldn't read file!",13,10,0
  1966. FileErrorText3:    dc.b    "ERROR: Incorrect filetype!",13,10,0
  1967. MemErrorText1:    dc.b    "ERROR: Out of memory!",13,10,0
  1968.  
  1969. ;Strings, Main menu
  1970.  
  1971. MenuText1:    dc.b    13,10,"ShellTerm menu. Please choose item:",13,10
  1972.         dc.b    13,10,"S) Statistics"
  1973.         dc.b    13,10,"C) Clear statistics"
  1974.         dc.b    13,10,"D) Dialer"
  1975.         dc.b    13,10,"O) Send CTRL-P (ASCII: DLE #16 $10 &020)"
  1976.         dc.b    13,10,"F) Reset font"
  1977.         dc.b    13,10,"X) Clear screen"
  1978.         dc.b    13,10,"R) Reset modem (Using Hayes-commands)"
  1979.         dc.b    13,10,"H) Hangup line (Using Hayes-commands)"
  1980.         dc.b    13,10,"P) Preferences"
  1981.         dc.b    13,10,"?) Program and author information"
  1982.         dc.b    13,10,"Q) Quit ShellTerm"
  1983.         dc.b    13,10,"E) Exit menus",13,10
  1984.         dc.b    13,10,"Selection: ",0
  1985. InfoText1:    dc.b    "Information",13,10,0
  1986. CTRL_PText1:    dc.b    "CTRL-P sent",13,10,0
  1987. ExitText1:    dc.b    "Exit",13,10
  1988. TerminalText1:    dc.b    13,10,"Terminal mode active:",13,10,0
  1989. StartText1:    dc.b    "Welcome to ShellTerm. Use CTRL-P to get menu.",13,10,0
  1990. ResetFText1:    dc.b    "Reset font",13,10,0
  1991. QuitText1:    dc.b    "Quit",13,10,0
  1992. StatsText1:    dc.b    "Statistics:",13,10,0
  1993. StatsText2:    dc.b    "Statistics",13,10,0
  1994. DialerText1:    dc.b    "Dialer",13,10,0
  1995. PrefsText1:    dc.b    "Preferences",13,10,0
  1996. ReceivedText1:    dc.b    "                            ",00,00,0    ;max of 4294967295
  1997. ;            "   4294967295 bytes received",CR,LF
  1998. SentText1:    dc.b    "                        ",00,00,0    ;max of 4294967295
  1999. ;            "   4294967295 bytes sent",CR,LF
  2000. fstrl1:        dc.b    "   %10.ld bytes received",13,10,0
  2001. fstrl2:        dc.b    "   %10.ld bytes sent",0
  2002. ClearText1:    dc.b    "Cleared",13,10,0
  2003. ClearText3:    dc.b    "Reset",13,10,0
  2004. CRLFText1:    dc.b    CR,LF,0
  2005. ResetText1:    dc.b    "Reset",13,10,0
  2006. ResetText2:    dc.b    "ATZ",13,10,0
  2007. HangUpText1:    dc.b    "Hangup",13,10,0
  2008. HangUpText2:    dc.b    "+++",0
  2009. HangUpText3:    dc.b    "ATH0",13,10,0
  2010. PlainText1:    dc.b    $9b,$30,$6d,0
  2011. ClearSText1:    dc.b    $1B,$5B,$30,$3B,$30,$48,$1B,$5B,$4A,0
  2012.  
  2013. ;Preferences
  2014.  
  2015. PrefsText2:    dc.b    13,10,"ShellTerm preferences:",13,10
  2016. PrefText3:    dc.b    13,10,"Options:   (S)elect speeds      (L)ocal echo"
  2017.         dc.b    13,10,"           (R)eset settings     (V)iew settings"
  2018.         dc.b    13,10,"      OUT: (1) CR translate     (2) LF translate"
  2019.         dc.b    13,10,"       IN: (3) CR translate     (4) LF translate"
  2020.         dc.b    13,10,"           (5) Set databits     (6) Set stopbits",13,10
  2021.         dc.b    13,10,"           (M)ain menu          (E)xit menus",13,10
  2022.         dc.b    13,10,"Selection: ",0
  2023. ViewText1:    dc.b    "View settings",13,10,0
  2024. SpeedText11:    dc.b    "Speed",13,10,0
  2025. EchoText1:    dc.b    "Toggle echo",13,10,0
  2026. CRTransText1:    dc.b    "CR translate (OUT)",13,10,0
  2027. LFTransText1:    dc.b    "LF translate (OUT)",13,10,0
  2028. CRTransText3:    dc.b    "CR translate (IN)",13,10,0
  2029. LFTransText3:    dc.b    "LF translate (IN)",13,10,0
  2030. EchoText2:    dc.b    13,10,"Local echo is now enabled",13,10,0
  2031. EchoText3:    dc.b    13,10,"Local echo is now disabled",13,10,0
  2032. DBitsText1:    dc.b    "Toggle databits",13,10,0
  2033. DBitsText2:    dc.b    13,10,"Using 7 databits",13,10,0
  2034. DBitsText3:    dc.b    13,10,"Using 8 databits",13,10,0
  2035. DBitsText4:    dc.b    13,10,"ERROR: Couldn't set databits!",13,10,0
  2036. SBitsText1:    dc.b    "Toggle stopbits",13,10,0
  2037. SBitsText2:    dc.b    13,10,"Using 1 stopbit",13,10,0
  2038. SBitsText3:    dc.b    13,10,"Using 2 stopbits",13,10,0
  2039. SBitsText4:    dc.b    13,10,"ERROR: Couldn't set stopbits!",13,10,0
  2040. CRTransText2:    dc.b    13,10,"(N)one, (S)trip, (A)dd LF: ",0
  2041. LFTransText2:    dc.b    13,10,"(N)one, (S)trip, (A)dd CR: ",0
  2042. AnyKeyText1:    dc.b    13,10,"Please press any key: ",0
  2043. NoneText1:    dc.b    "None",13,10,0
  2044. StripText1:    dc.b    "Strip",13,10,0
  2045. AddText1:    dc.b    "Add",13,10,0
  2046.  
  2047. CurrentText1:    dc.b    13,10,"Current settings: Speed (",0
  2048. CurrentText2:    dc.b    "), Local echo (",0
  2049. CurrentText3:    dc.b    "                  CR xlate out (",0
  2050. CurrentText4:    dc.b    "), LF xlate out (",0
  2051. CurrentText5:    dc.b    "                  CR xlate in (",0
  2052. CurrentText6:    dc.b    "), LR xlate in (",0
  2053. CurrentText7:    dc.b    ")",13,10,0
  2054. CurrentText8:    dc.b    "                  Databits (",0
  2055. CurrentText9:    dc.b    ") Stopbits (",0
  2056. NAText1:    dc.b    "N/A",0
  2057. DefText1:    dc.b    "Default",0
  2058. StarText1:    dc.b    "*",0
  2059. SpaceText1:    dc.b    " ",0
  2060. NText1:        dc.b    "N",0
  2061. SText1:        dc.b    "S",0
  2062. AText1:        dc.b    "A",0
  2063. OneText1:    dc.b    "1",0
  2064. TwoText1:    dc.b    "2",0
  2065. SevenText1:    dc.b    "7",0
  2066. EightText1:    dc.b    "8",0
  2067.  
  2068. ;Speed prefs
  2069.  
  2070. SpeedText1:    dc.b    13,10,"1) 110 bps",13,10
  2071. SpeedText2:    dc.b    "2) 300 bps",13,10
  2072. SpeedText3:    dc.b    "3) 1200 bps",13,10
  2073. SpeedText4:    dc.b    "4) 2400 bps",13,10
  2074. SpeedText5:    dc.b    "5) 4800 bps",13,10
  2075. SpeedText6:    dc.b    "6) 9600 bps",13,10
  2076. SpeedText7:    dc.b    "7) 19 200 bps",13,10
  2077. SpeedText8:    dc.b    "8) 38 400 bps",13,10
  2078. SpeedText9:    dc.b    "9) 57 600 bps",13,10
  2079. SpeedText10:    dc.b    "0) 115 200 bps",13,10
  2080.         dc.b    13,10,"Options: (0-9) Select speed     (-) Previous menu",13,10
  2081.         dc.b    13,10,"           (M)ain menu          (E)xit menus",13,10
  2082.         dc.b    13,10,"Selection: ",0
  2083. SpeedText12:    dc.b    13,10,"ERROR: Couldn't set that speed. Please reselect!",13,10,0
  2084. SerSetText1:    dc.b    13,10,"ERROR: Couldn't set serial parameters!",13,10,0
  2085. fstrl3:        dc.b    "%ld",0
  2086. SpeedText90:    dc.b    0,0,0,0,0,0,0,0
  2087.  
  2088. ;Dialer stuff
  2089.  
  2090. DialerText2:    dc.b    13,10,"ShellTerm auto-dialer (phonebook)",13,10
  2091.         dc.b    13,10,"Entries:",13,10,13,10,0
  2092. PrefixText1:    dc.b    "Prefix: ",0
  2093. EntryText1:    dc.b    "1) ",0
  2094. EntryText2:    dc.b    "2) ",0
  2095. EntryText3:    dc.b    "3) ",0
  2096. EntryText4:    dc.b    "4) ",0
  2097. EntryText5:    dc.b    "5) ",0
  2098. EntryText6:    dc.b    "6) ",0
  2099. EntryText7:    dc.b    "7) ",0
  2100. EntryText8:    dc.b    "8) ",0
  2101. EntryText9:    dc.b    "9) ",0
  2102. EntryText10:    dc.b    "0) ",0
  2103. DialerText3:    dc.b    13,10,"Options: (0-9) Un/select entry  (R)elist numbers"
  2104.         dc.b    13,10,"           (S)ingle dial        (D)ial list"
  2105.         dc.b    13,10,"           (C)lear list         (A)ll",13,10
  2106.         dc.b    13,10,"           (M)ain menu          (E)xit menus",13,10
  2107. SelectionText1:    dc.b    13,10,"Selection: ",0
  2108. DialText1:    dc.b    "Dial list",13,10,0
  2109. MainMenuText1:    dc.b    "Main menu",13,10,0
  2110. SingleText1:    dc.b    "Dial number",13,10,0
  2111. SingleText2:    dc.b    "Number to dial: ",0
  2112. RelistText1:    dc.b    "Relist",13,10,13,10,0
  2113. EntryTextXIV:    dc.b    "Entry",13,10,0
  2114. ClearText2:    dc.b    "Clear",13,10,0
  2115. AllText1:    dc.b    "All",13,10,0
  2116. HelpText1:    dc.b    "Help",13,10,0
  2117. DialingText1:    dc.b    13,10,"Dialing: ",0
  2118. DialText2:    dc.b    13,10,"[Space] to skip, [Backspace] to remove this entry, [Escape] to quit",13,10,0
  2119. ConnectText1:    dc.b    "Connection established",13,10,0
  2120. BusyText1:    dc.b    "Busy",13,10,0
  2121. SkippedText1:    dc.b    "Skipping entry",13,10,0
  2122. CancelledText1:    dc.b    "Quitting",13,10,0
  2123. RemoveText1:    dc.b    "Removing this entry",13,10,0
  2124. EmptyText1:    dc.b    13,10,"List is empty",13,10,0
  2125. SelectedText1:    dc.b    13,10,"Entries selected:",13,10,0
  2126. SelectText1:    dc.b    "1 (",0
  2127. SelectText2:    dc.b    "2 (",0
  2128. SelectText3:    dc.b    "3 (",0
  2129. SelectText4:    dc.b    "4 (",0
  2130. SelectText5:    dc.b    "5 (",0
  2131. SelectText6:    dc.b    "6 (",0
  2132. SelectText7:    dc.b    "7 (",0
  2133. SelectText8:    dc.b    "8 (",0
  2134. SelectText9:    dc.b    "9 (",0
  2135. SelectText0:    dc.b    "0 (",0
  2136. SelectText11:    dc.b    "*) ",0
  2137. SelectText12:    dc.b    " ) ",0
  2138. SelectText13:    dc.b    "*)",0
  2139. SelectText14:    dc.b    " )",0
  2140. PhoneBookName:    dc.b    "S:ShellTerm.phone",0
  2141.  
  2142. ;Strings, names
  2143.  
  2144. STVersion:    dc.b    "$VER: "
  2145. UsageText1:    dc.b    "ShellTerm 1.05 (15.8.92) (C)opyright Tomi Blinnikka 1992",13,10,13,10
  2146. ;        dc.b    10,"           !!! BETA TESTER VERSION !!!",13,10,13,10,13,10
  2147.         dc.b    "USAGE: ShellTerm [Unit] [Device]",13,10,13,10
  2148.         dc.b    "       Where: [Unit] is the unit number",13,10
  2149.         dc.b    "              [Device] is the device name",13,10,13,10
  2150.         dc.b    "       Default [Device] is serial.device",13,10,13,10
  2151.         dc.b    "Use current shell as a terminal program.",13,10
  2152.         dc.b    "See docs for more information.",13,10,0
  2153. AuthorText1:    dc.b    13,10,"Name    : ShellTerm",13,10
  2154.         dc.b    "Version : 1.05 (15.8.92)",13,10
  2155.         dc.b    "Author  : Tomi Blinnikka",13,10,13,10
  2156.         dc.b    "(C)opyright Tomi Blinnikka 1992",13,10,0
  2157.         ds.l    0
  2158.  
  2159. ;Buffers
  2160.  
  2161. Buffer1:    dcb.b    2,0        ;For writes to serial (read from CLI)
  2162. Buffer2:    dcb.b    2,0        ;For reads
  2163. Buffer3:    dcb.b    BUFLEN,0    ;For reads from serial
  2164. Buffer4:    dcb.b    BUFLEN*2,0    ;For writes to CLI
  2165.  
  2166. LoadBuffer1:    dcb.b    4,0        ;for header
  2167. DialPrefix:    dc.b    "ATDT"        ;dial prefix
  2168.         dcb.b    18-4,0
  2169. Entry1:        dcb.b    18,0        ;Entry 1
  2170. Entry2:        dcb.b    18,0        ;Entry 2
  2171. Entry3:        dcb.b    18,0        ;Entry 3
  2172. Entry4:        dcb.b    18,0        ;Entry 4
  2173. Entry5:        dcb.b    18,0        ;Entry 5
  2174. Entry6:        dcb.b    18,0        ;Entry 6
  2175. Entry7:        dcb.b    18,0        ;Entry 7
  2176. Entry8:        dcb.b    18,0        ;Entry 8
  2177. Entry9:        dcb.b    18,0        ;Entry 9
  2178. Entry10:    dcb.b    18,0        ;Entry 10
  2179. DialBuffer1:    dcb.b    18,0        ;for single dial
  2180.  
  2181.         end
  2182.  
  2183.